Repository navigation
Chicken Spawner: keep the burrow target in PvP mode - #6056
moss-orbit-9f339e wants to merge 2 commits into
Conversation
The burrow target check reads IDs from the wrong table. Validate targetData.targetID and read its team directly. Reject the burrow itself as a target. Gameplay/sync: changes chicken burrow target selection. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Closing with the other chicken PvP PRs; I can send them as one PR if you want them. |
sprunk
left a comment
There was a problem hiding this comment.
Would be nice to get a gameplay check but this generally looks fine regardless.
UnitFinished tested noTarget.name, which is always nil, so every finished immobile unit of a human team became a burrow target, Wolverine mines too. Test the unit's name instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Gameplay check on master 81b9b72: master / master + the first commit / master + both commits. The second commit changes What was played: live games on Nuclear Winter, 4800 frames. Two Null AI teams on different ally teams play the "human" sides (the spawner counts every team that is not a chicken AI and not allied with it). "Chicken: Custom" with
The comment "HOW BURROW TARGETING WORKS" says chickens attack a random unit of the cached target's owner. The code (not changed here) sends them to the cached structure itself. Not tested: a multiplayer game (sync), capture or transfer of a targeted structure, terraform units (also in AI-assisted: test written and run with Claude Code. |
In
unit_spawner.lua,UpdateBurrowTarget(burrowID, targetArg)stores the chosen target intargetData(data.burrows[burrowID]). But it then checksspValidUnitID(data.targetID), anddatais the table of all burrows and targets, which has notargetID. So the check getsniland fails, and the next branch setstargetData.targetID = nil. The code also reads the team withspGetUnitTeam(data.targets[data.targetID]), butdata.targetsmaps a unit ID to a team ID. A burrow also starts withtargetID = unitID(its own ID), so a burrow with no candidate would keep itself as the target.This reads
targetData.targetIDin both places, passes the unit ID tospGetUnitTeam, and treats a target equal toburrowIDas not valid. In PvP mode the burrow now keeps the nearest enemy structure as its cached target. The spawn code (if pvp and data.burrows[burrowID].targetID) reads the cached structure's position and sends newly spawned chickens a FIGHT order toward it. They can engage other units along the way.A second commit fixes the
noTargettest inUnitFinished:noTarget.nameis always nil, so Wolverine mines also became burrow targets. It now readsnoTarget[name], asChooseTargetalready does.Gameplay/sync: this changes where chickens from a burrow go in PvP mode. The gadget changes synced targeting state; no multiplayer sync comparison was run. Games that are not in PvP mode do not use the cached target. PvP mode is detected separately; a separate PR fixes the detection when the human team IDs have gaps or include team 0 (for example a 1v1 with chickens).
Testing: a live game on the test bench. At frame 120 the test script loads
UpdateBurrowTargetfrom the file and runs it with test inputs: burrow ID 10 (its own target at the start) and structure candidates 20 and 30 at distances 100 and 200. The distance, validity and team queries are replaced by stubs. The test runs five cases and logs the target ID and the target team. It ran on master, this change and master again:The two master runs gave the same numbers. This is a call of the real function with stub inputs, not a played PvP chicken game.
AI disclosure: found by OpenAI Codex in a code audit; the live test was written by Codex; checked, edited and tested with Claude Code.
🤖 Generated with Claude Code